<!-- <title>瑞众银保“五个一”功成--营业部经理微沙龙记录<title> -->

<style lang="less" scoped>
@import '@css/list.less';
</style>

<template>
  <div id="app">
    <van-sticky>
      <div class="title">微沙龙记录</div>
    </van-sticky>
    <div
      style="margin: 20px auto; text-align: center"
      v-if="recentYb51SalesManagerWeekSalonRecordList.length == 0"
    >
      暂无数据
    </div>
    <van-collapse
      v-model="activeNames"
      accordion
      v-for="(item, index) of recentYb51SalesManagerWeekSalonRecordList"
      :key="index"
    >
      <van-collapse-item :title="`对象：${item.channel}`" :label="item.createDate" :name="index">
        <van-cell-group inset>
          <van-field readonly class="fbox" v-model="item.channel" label="渠道及网点"></van-field>

          <van-field readonly class="fbox" v-model="item.form" label="形式"></van-field>

          <van-field class="fbox" v-model="item.product" label="产品" readonly></van-field>

          <van-field readonly class="fbox" v-model="item.signingNum" label="签约件数"></van-field>

          <van-field readonly class="fbox" v-model="item.premium" label="保费(万)"></van-field>

          <van-field class="fbox" v-model="item.specifyDate" label="指定日期" readonly></van-field>

          <van-field label="图片">
            <template #input>
              <van-uploader
                :deletable="false"
                v-model="item.uploaderImgList"
                :max-count="1"
              ></van-uploader>
            </template>
          </van-field>
        </van-cell-group>
      </van-collapse-item>
    </van-collapse>
  </div>
</template>
<script setup>
import {
  onBeforeMount,
  onMounted,
  onUnmounted,
  watch,
  computed,
  provide,
  inject,
  ref,
  reactive,
  nextTick,
  h
} from 'vue'
import { useRoute, useRouter } from 'vue-router'
const router = useRouter()
const route = useRoute()
const dayjs = inject('$dayjs')
const showPageLoading = inject('showPageLoading')
const hidePageLoading = inject('hidePageLoading')
const showAllNonBaseMenuItem = inject('showAllNonBaseMenuItem')
const hideAllNonBaseMenuItem = inject('hideAllNonBaseMenuItem')
import { isIOS, parseTime, handleFontSize } from '@/utils'
import { yb51_sales_manager_week_salon_record_getListByWeeksAndAgentCode } from '@/request/api.js'

onMounted(() => {
  agentcode = route.query.agentcode
  weeks = route.query.weeks
  getrecentYb51SalesManagerWeekSalonRecordList()
})

let agentcode
let weeks

const activeNames = ref(['1'])

//获取经理最近三天拜访记录列表
const recentYb51SalesManagerWeekSalonRecordList = ref([])

function getrecentYb51SalesManagerWeekSalonRecordList() {
  showPageLoading()
  let params = new FormData()
  params.append('agentCode', agentcode)
  params.append('week', weeks)
  yb51_sales_manager_week_salon_record_getListByWeeksAndAgentCode(params).then((r) => {
    hidePageLoading()
    if (r.status == 200) {
      recentYb51SalesManagerWeekSalonRecordList.value = r.data.map((item) => {
        item['uploaderImgList'] = [{ url: item.fileUrl }]
        return item
      })
    } else {
      console.log('出错了，请重试')
      alert('出错了，请重试')
    }
  })
}
</script>
